package cn.itsource.fallback;
import cn.itsource.domain.BillDto;
import cn.itsource.exception.GlobalException;
import cn.itsource.openfeign.ValuationOpenFeign;
import cn.itsource.result.JSONResult;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @program fccar_tt
 * @Description
 * @Author TT
 * @Date 2024/09/04 17:41
 * @Version 1.0
 */
@Component
public class ValuationOpenFeignFallbackFactory implements FallbackFactory<ValuationOpenFeign> {
    @Override
    public ValuationOpenFeign create(Throwable cause) {
        return new ValuationOpenFeign() {
            @Override
            public JSONResult getValuation(String mileage) {
                return JSONResult.error(cause.getMessage());
            }

            @Override
            public JSONResult getBillDto(Integer hour) {
                return JSONResult.error(cause.getMessage());
            }

            @Override
            public JSONResult getProportion() {
                return JSONResult.error(cause.getMessage());
            }
        };
    }
}
